//
//  XMPPManager.h
//  EWork
//
//  Created by administrator on 14-12-2.
//  Copyright (c) 2014年 gaobo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
#import "XMPPFramework.h"

@class XMPPMessage;
@class XMPPRoster;
@class XMPPPosterCoreDataStorage;

@interface XMPPManager : NSObject<UIApplicationDelegate>{
    XMPPStream *xmppStream;
    XMPPReconnect *xmppReconnect;
    XMPPRoster *xmppRoster;
    XMPPRosterCoreDataStorage *xmppRosterStorage;
    
    NSString *passWord;
    
    BOOL allowSelfSignedCertificates;
    BOOL allowSSLHostNameMismatch;
    BOOL isXmppConnected;
}

#pragma mark -----Core Data 核心API-----
@property (readonly, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (NSManagedObjectContext *)managedObjectContext_roster;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;

#pragma mark -------连接数据库-----------
- (BOOL)connect;
- (void)disconnect;

#pragma mark --------创建单例-----------
+(XMPPManager*)sharedInstance;


#pragma mark -------配置XML流-----------
- (void)setupStream;
- (void)teardownStream;


#pragma mark ----------收发信息------------
- (void)goOnline;
- (void)goOffline;

- (void)sendMessage:(XMPPMessage *)aMessage;
- (void)addSomeBody:(NSString *)userId;


#pragma mark ---------文件传输-----------
-(void)sendFile:(NSData*)aData toJID:(XMPPJID*)aJID;

@end
